import type { AuditTaskPageQuery, AuditTaskVO } from '@/services/model/auditModel';
import type { PageResult } from '@/services/model/baseModel';
import { request } from '@/utils/http';

const BASE_URL = '/api/v1/audit/tasks';

/**
 * 获取审核任务分页列表
 */
export function getAuditTaskPage(query: AuditTaskPageQuery) {
  return request.Get<PageResult<AuditTaskVO>>(`${BASE_URL}/page`, {
    params: query,
  });
}

/**
 * 通过审核任务
 * @param taskId 任务ID
 */
export function approveAuditTask(taskId: number) {
  return request.Post(`${BASE_URL}/${taskId}/approve`);
}

/**
 * 拒绝审核任务
 * @param taskId 任务ID
 * @param reasons 拒绝原因
 */
export function rejectAuditTask(taskId: number, reasons: string) {
  return request.Post(`${BASE_URL}/${taskId}/reject`, {
    reasons,
  });
}
